import { ApiProperty } from '@nestjs/swagger';
import { IsOptional, IsString, MaxLength, MinLength } from 'class-validator';

export class UpdatePostDTO {
  @ApiProperty({ example: '更新后的文章标题', description: '文章标题', required: false })
  @IsOptional()
  @IsString({ message: '文章标题必须是字符串' })
  @MaxLength(100, { message: '文章标题长度不能超过100个字符' })
  @MinLength(2, { message: '文章标题长度不能少于2个字符' })
  title?: string;

  @ApiProperty({ example: '更新后的文章内容...', description: '文章内容', required: false })
  @IsOptional()
  @IsString({ message: '文章内容必须是字符串' })
  @MinLength(10, { message: '文章内容长度不能少于10个字符' })
  content?: string;
}